﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LIM.forms.uc_CRM_LienHe_ChiTiet
{
    public partial class uc_CRM_LienHe_ChiTiet_HopDongDaKy : UserControl
    {
        public uc_CRM_LienHe_ChiTiet_HopDongDaKy()
        {
            InitializeComponent();
        }
        private void uc_CRM_LienHe_ChiTiet_HopDongDaKy_Load(object sender, EventArgs e)
        {
            parentForm = (radForm_CRM_LienHe_ChiTiet)this.ParentForm;
            if (parentForm != null)
            {
                parentForm.OnLoadChange += new radForm_CRM_LienHe_ChiTiet.LoadChange(parentForm_OnRowChange);
            }
            if (parentForm.SelectedEntity != null)
            {
                LoadData();
            }
        }
        void LoadData()
        {
            if (parentForm.SelectedEntity.RowID != 0)
            {
                radGridView_HopDongDaKy.DataSource = parentForm.controller.LoadHopDongLienHe(parentForm.SelectedEntity.RowID);
            }
        }
        radForm_CRM_LienHe_ChiTiet parentForm = null;
        void parentForm_OnRowChange()
        {
            if (parentForm.SelectedEntity != null)
            {
                LoadData();
            }
        }

        private void radMenuItem1_Click(object sender, EventArgs e)
        {
            LoadData();
        }
    }
}
